home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
EnigmA Amiga Run 1997 June
/
EnigmA AMIGA RUN 19 (1997)(G.R. Edizioni)(IT)[!][issue 1997-06][EAR-CD III].iso
/
imagestudio
/
imagestudio68000
/
rexx
/
balancetest.isrx
next >
Wrap
Text File
|
1995-02-24
|
4KB
|
161 lines
/* ImageStudio ARexx script **************************************/
/* Allow commands to return results */
options results
/* On error, goto ERROR:. Comment out this line if you wish to */
/* perform your own error checking. */
signal on error
/* BEGIN PROGRAM *************************************************/
/* See if we have an image already */
IMAGEINFO_GET STEM imageinfo.
if imageinfo.changed == 1 then do
REQUEST_MESSAGE TEXT '"Project has changed, continue?"',
BUTTONTEXT '"OK|Cancel"' AUTOCANCEL
end
else if imageinfo.changed == -1 then do
/* Open a filerequester to get an image to operate on */
REQUEST_FILE TITLE '"Choose image..."' VAR imagefile
OPEN FILE '"'imagefile'"'
/* Get the new image's details */
IMAGEINFO_GET STEM 'imageinfo.'
end
/* Get the number of steps across to perform */
REQUEST_MESSAGE TEXT '"Choose number of steps..."',
BUTTONTEXT '"3|5|7|9|15|Cancel"' AUTOCANCEL
/* Get the number of steps */
select
when result == 1 then
num_steps = 3
when result == 2 then
num_steps = 5
when result == 3 then
num_steps = 7
when result == 4 then
num_steps = 9
when result == 5 then
num_steps = 15
otherwise
nop
end
/* If the image is colour mapped, change it to 24bit */
if imageinfo.depth ~= 24 then
COLOURS SIXTEENMILLION
/* Perform the colour balance changes */
do y = 0 to 2
do x = 0 to (num_steps - 1)
/* Work out the region to select */
left = (x * imageinfo.width) % num_steps
right = (((x + 1) * imageinfo.width) % num_steps) - 1
top = (y * imageinfo.height) % 3
bottom = (((y + 1) * imageinfo.height) % 3) - 1
REGION_SET left top TO right bottom
/* Work out the value between -100 and +100 */
balanceval = (200 * x) % (num_steps - 1)
balanceval = balanceval - 100
/* Adjust the appropriate colour balance */
select
when y == 0 then
BALANCE BRIGHTNESS balanceval
when y == 1 then
BALANCE CONTRAST balanceval
when y == 2 then
BALANCE GAMMA balanceval
otherwise
nop
end
end
end
/* Clear the region */
REGION_CLEAR
/* END PROGRAM ***************************************************/
exit
/* On ERROR */
ERROR:
/* If we get here, either an error occurred with the command's */
/* execution or there was an error with the command itself. */
/* In the former case, rc2 contains the error message and in */
/* the latter, rc2 contains an error number. SIGL contains */
/* the line number of the command which caused the jump */
/* to ERROR: */
if datatype(rc2,'NUMERIC') == 1 then do
/* See if we can describe the error with a string */
select
when rc2 == 103 then
err_string = "ERROR 103, "||,
"out of memory at line "||SIGL
when rc2 == 114 then
err_string = "ERROR 114, "||,
"bad command template at line "||SIGL
when rc2 == 115 then
err_string = "ERROR 115, "||,
"bad number for /N argument at line "||SIGL
when rc2 == 116 then
err_string = "ERROR 116, "||,
"required argument missing at line "||SIGL
when rc2 == 117 then
err_string = "ERROR 117, "||,
"value after keywork missing at line "||SIGL
when rc2 == 118 then
err_string = "ERROR 118, "||,
"wrong number of arguments at line "||SIGL
when rc2 == 119 then
err_string = "ERROR 119, "||,
"unmatched quotes at line "||SIGL
when rc2 == 120 then
err_string = "ERROR 120, "||,
"line too long at line "||SIGL
when rc2 == 236 then
err_string = "ERROR 236, "||,
"unknown command at line "||SIGL
otherwise
err_string = "ERROR "||rc2||", at line "||SIGL
end
end
else if rc2 == 'RC2' then do
err_string = "ERROR in command at line "||SIGL
end
else do
err_string = rc2||", line "||SIGL
end
request_message TEXT '"'err_string'"'
exit